#include "widget.h"
#include "ui_widget.h"
#include<QPushButton>
#include<QtDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
//    QPushButton*button1=new QPushButton(this);
//    button1->setText("按钮1");
//    button1->move(0,0);
//    QPushButton*button2=new QPushButton(this);
//    button2->setText("按钮2");
//    button2->move(200,200);
//    qDebug()<<"按钮1的坐标：["<<button1->x()<<","<<button1->y()<<"]";

//    qDebug()<<"按钮2的坐标：["<<button2->x()<<","<<button2->y()<<"]";

      QPushButton*button=new QPushButton(this);
      button->setText("关闭按钮");
      button->move(500,500);
      button->setFixedSize(100,100);
      button->setStyleSheet("QPushButton{background-color:red;color:blue}");
      resize(1000,1000); //调整窗口大小
      connect(button,&QPushButton::clicked,this,&QPushButton::close);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    this->close();
}
